/* 获取元素 */
const jokeEl = document.getElementById("joke");
const jokeBtn = document.getElementById("jokeBtn");
//发送请求
const generateJoke = async () => {
  const config = {
    headers: {
      Accept: "application/json",
    },
  };

  const res = await fetch("https://icanhazdadjoke.com", config);

  const data = await res.json();

  jokeEl.innerHTML = data.joke;
};

/* 点击事件 */
jokeBtn.addEventListener("click", generateJoke);
